//
//  MainDailyBookCollectionCell.m
//  MirrorCharge
//
//  Created by dllo on 16/10/20.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MainDailyBookCollectionCell.h"
#import "BaseCollectionView.h"
#import "NormalCollectionViewDataSource.h"
#import "BaseModel.h"
#import "HLMacro.h"


// cell
#import "HLDailyBookHeadCollectionCell.h"
#import "HLDailyBookContentCollectionCell.h"

@interface MainDailyBookCollectionCell ()<UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>

@property (weak, nonatomic) IBOutlet BaseCollectionView *collectionView;

@property (nonatomic, strong) NormalCollectionViewDataSource *dataSource;

@end

@implementation MainDailyBookCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _dataSource = [NormalCollectionViewDataSource NormalCollectionViewDataSource];
    _dataSource.sourceArray = @[@[[BaseModel new]], @[[BaseModel new]]];
    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:0];
    NSIndexPath *indexPath1 = [NSIndexPath indexPathForItem:0 inSection:1];
    _dataSource.reviseIndexPaths = @[indexPath, indexPath1];
    _dataSource.type = NormalCollectionViewTypeArray;
    _dataSource.reviseReuses = @[@"HLDailyBookHeadCollectionCell", @"HLDailyBookContentCollectionCell"];
    _collectionView.delegate = self;
    _collectionView.dataSource = _dataSource;
    
    [_collectionView registerNib:[UINib nibWithNibName:@"HLDailyBookHeadCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HLDailyBookHeadCollectionCell"];
    [_collectionView registerNib:[UINib nibWithNibName:@"HLDailyBookContentCollectionCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HLDailyBookContentCollectionCell"];
}

- (void)setModel:(BaseModel *)model
{
    [_collectionView reloadData];
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(SCREEN_WIDTH, SCREEN_WIDTH);
}
@end
